//
//  FGMessageCell.h
//  FGChatKit
//
//  Created by Henry on 2020/8/13.
//  Copyright © 2020 Henry. All rights reserved.
//

#import "FGCommonTableViewCell.h"
#import "FGMessageCellData.h"

@class FGMessageCell;

NS_ASSUME_NONNULL_BEGIN

@protocol FGMessageCellDelegate <NSObject>

@optional
/// 长按消息回调
/// @param cell 委托者，消息单元
- (void)onLongPressMessage:(FGMessageCell *)cell;

/// 重发消息点击回调
/// @param cell 委托者，消息单元
- (void)onRetryMessage:(FGMessageCell *)cell;

/// 点击消息回调
/// @param cell 委托者，消息单元
- (void)onSelectMessage:(FGMessageCell *)cell;

/// 点击消息单元中消息头像的回调
/// @param cell 委托者，消息单元
- (void)onSelectMessageAvatar:(FGMessageCell *)cell;

/// 点击消息链接
- (void)onSelectLinkUrl:(FGMessageCell *)cell string:(NSString *)string;

/// 图片下载完成
- (void)imageDownloadComplete:(FGMessageCell *)cell;

/// 表单提交
- (void)fromSubmit:(NSArray *)fromArr;

/// 点击了模板消息上的Cell
- (void)didSelectedTemplateMessageCell:(NSDictionary *)templateDict;

@end

@interface FGMessageCell : FGCommonTableViewCell

/// 时间提示
@property (nonatomic, strong) UILabel *timeTipLabel;
/// 头像视图
@property (nonatomic, strong) UIImageView *avatarView;
/// 昵称标签
@property (nonatomic, strong) UILabel *nameLabel;

/// 容器视图
/// 包裹了 MesageCell 的各类视图，作为 MessageCell 的“底”，方便进行视图管理与布局
@property (nonatomic, strong) UIView *container;
/// 活动指示器
/// 在消息发送中提供转圈图标，表明消息正在发送
@property (nonatomic, strong) UIActivityIndicatorView *indicator;
/// 重发视图
@property (nonatomic, strong) UIImageView *retryView;
/// 消息已读控件
@property (nonatomic, strong) UIImageView *readReceiptImageView;

@property (nonatomic, readonly) FGMessageCellData *messageData;
@property (nonatomic, weak) id<FGMessageCellDelegate> delegate;

- (void)fillWithData:(FGCommonCellData *)data;

@end

NS_ASSUME_NONNULL_END
